home *** CD-ROM | disk | FTP | other *** search
Java Source | 2000-06-23 | 5.3 KB | 218 lines |
- import java.awt.*;
- import java.awt.event.KeyEvent;
-
- public class ResultsDialog extends Dialog
- {
- public ResultsDialog(Frame parent)
- {
- super(parent, true);
-
- // This code is automatically generated by Visual Cafe when you add
- // components to the visual environment. It instantiates and initializes
- // the components. To modify the code, only use code syntax that matches
- // what Visual Cafe can generate, or Visual Cafe may be unable to back
- // parse your Java file into its visual environment.
- //{{INIT_CONTROLS
- GridBagLayout gridBagLayout;
- gridBagLayout = new GridBagLayout();
- setLayout(gridBagLayout);
- setVisible(false);
- setSize(365,121);
- setBackground(new Color(-1644826));
- label2 = new java.awt.Label("text");
- label2.setBounds(52,35,25,25);
- GridBagConstraints gbc;
- gbc = new GridBagConstraints();
- gbc.gridx = 1;
- gbc.gridy = 1;
- gbc.gridwidth = 2;
- gbc.weightx = 1.0;
- gbc.anchor = GridBagConstraints.NORTHWEST;
- gbc.fill = GridBagConstraints.NONE;
- gbc.insets = new Insets(0,0,0,0);
- ((GridBagLayout)getLayout()).setConstraints(label2, gbc);
- add(label2);
- label3 = new java.awt.Label("text");
- label3.setBounds(52,60,25,25);
- gbc = new GridBagConstraints();
- gbc.gridx = 1;
- gbc.gridy = 2;
- gbc.gridwidth = 2;
- gbc.weightx = 1.0;
- gbc.anchor = GridBagConstraints.NORTHWEST;
- gbc.fill = GridBagConstraints.NONE;
- gbc.insets = new Insets(0,0,0,0);
- ((GridBagLayout)getLayout()).setConstraints(label3, gbc);
- add(label3);
- defaultBorder1 = new DefaultBorder();
- defaultBorder1.setBounds(294,82,64,26);
- gbc = new GridBagConstraints();
- gbc.gridx = 3;
- gbc.gridy = 3;
- gbc.fill = GridBagConstraints.NONE;
- gbc.insets = new Insets(0,0,10,10);
- ((GridBagLayout)getLayout()).setConstraints(defaultBorder1, gbc);
- okButton = new java.awt.Button();
- okButton.setLabel("OK");
- okButton.setBounds(3,3,58,20);
- defaultBorder1.add(okButton);
- add(defaultBorder1);
-
- label1 = new java.awt.Label("text");
- label1.setBounds(52,10,25,25);
- gbc = new GridBagConstraints();
- gbc.gridx = 1;
- gbc.gridy = 0;
- gbc.gridwidth = 2;
- gbc.weightx = 1.0;
- gbc.anchor = GridBagConstraints.NORTHWEST;
- gbc.fill = GridBagConstraints.NONE;
- gbc.insets = new Insets(10,0,0,0);
- ((GridBagLayout)getLayout()).setConstraints(label1, gbc);
- add(label1);
- imageComponent1 = new ImageComponent();
- imageComponent1.setBounds(10,10,32,32);
- imageComponent1.setImage(Util.loadImage("images/info.gif", this));
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.gridheight = 3;
- gbc.anchor = GridBagConstraints.NORTHWEST;
- gbc.fill = GridBagConstraints.NONE;
- gbc.insets = new Insets(10,10,0,10);
- ((GridBagLayout)getLayout()).setConstraints(imageComponent1, gbc);
- add(imageComponent1);
- setTitle("Done Processing...");
- setResizable(false);
- //}}
-
- //{{REGISTER_LISTENERS
- SymWindow aSymWindow = new SymWindow();
- this.addWindowListener(aSymWindow);
- SymAction lSymAction = new SymAction();
- okButton.addActionListener(lSymAction);
- SymKey aSymKey = new SymKey();
- this.addKeyListener(aSymKey);
- imageComponent1.addKeyListener(aSymKey);
- label1.addKeyListener(aSymKey);
- label2.addKeyListener(aSymKey);
- label3.addKeyListener(aSymKey);
- okButton.addKeyListener(aSymKey);
- defaultBorder1.addKeyListener(aSymKey);
- //}}
- }
-
- public void setLabel1(String text)
- {
- label1.setText(text);
- }
-
- public String getLabel1()
- {
- return label1.getText();
- }
-
- public void setLabel2(String text)
- {
- label2.setText(text);
- }
-
- public String getLabel2()
- {
- return label2.getText();
- }
-
- public void setLabel3(String text)
- {
- label3.setText(text);
- }
-
- public String getLabel3()
- {
- return label3.getText();
- }
-
- /**
- * Shows or hides the component depending on the boolean flag b.
- * @paramLabel b if true, show the component; otherwise, hide the component.
- * @see java.awt.Component#isVisible
- */
- public void setVisible(boolean b)
- {
- if(b)
- {
- Dimension sSize = Toolkit.getDefaultToolkit().getScreenSize();
- Dimension dSize = getSize();
-
- setLocation((sSize.width - dSize.width) >> 1, (int)(0.33333333 * sSize.height));
- Toolkit.getDefaultToolkit().beep();
- }
- super.setVisible(b);
- }
-
- public void update(Graphics g)
- {
- paint(g);
- }
-
- public void close()
- {
- // Hide the Dialog
- setVisible(false);
- dispose();
- }
-
- //{{DECLARE_CONTROLS
- java.awt.Label label2;
- java.awt.Label label3;
- java.awt.Button okButton;
- java.awt.Label label1;
- ImageComponent imageComponent1;
- DefaultBorder defaultBorder1;
- //}}
-
- class SymWindow extends java.awt.event.WindowAdapter
- {
- public void windowClosing(java.awt.event.WindowEvent event)
- {
- Object object = event.getSource();
- if (object == ResultsDialog.this)
- ResultsDialog_WindowClosing(event);
- }
- }
-
- void ResultsDialog_WindowClosing(java.awt.event.WindowEvent event)
- {
- close();
- }
-
- class SymAction implements java.awt.event.ActionListener
- {
- public void actionPerformed(java.awt.event.ActionEvent event)
- {
- Object object = event.getSource();
- if (object == okButton)
- okButton_ActionPerformed(event);
- }
- }
-
- void okButton_ActionPerformed(java.awt.event.ActionEvent event)
- {
- close();
- }
-
- class SymKey extends java.awt.event.KeyAdapter
- {
- public void keyPressed(java.awt.event.KeyEvent event)
- {
- handleKeyPressed(event);
- }
- }
-
- void handleKeyPressed(java.awt.event.KeyEvent event)
- {
- if (event.getKeyCode() == KeyEvent.VK_ENTER)
- close();
- }
- }
-